#define _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>
void paixu(int n, int arr[100])
{
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - i - 1; j++)
        {
            if (arr[j] < arr[j + 1])
            {
                int temp = arr[j + 1];
                arr[j + 1] = arr[j];
                arr[j] = temp;
            }
        }
    }
}
int main() {
    int a = 0;
    while (scanf("%d", &a) != EOF)
    {
        int arr1[100];
        int i = 0;
        for (i = 0; i < a; i++)
        {
            scanf("%d", &arr1[i]);
        }
        int b = 0;
        scanf("%d", &b);
        int arr2[100];
        for (i = 0; i < b; i++)
        {
            scanf("%d", &arr2[i]);
        }
        paixu(a, arr1);
        paixu(b, arr2);
        int s = 0;
        int sum = 0;
        for (i = 0; i < a; i++)
        {
            if (arr2[s] >= arr1[i])
            {
                sum += 1;
                s += 1;
            }
            if (s == b)
            {
                i = a;
            }
        }
        printf("%d", sum);
    }
    return 0;
}